package com.cloudfun.campusshare.service;

import com.cloudfun.campusshare.common.constant.VerifyType;
import com.cloudfun.campusshare.common.response.BaseResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by linyangping on 2019/10/21.
 */
public interface VerifyCodeService {

    /**
     * 获取短信验证码
     *
     * @param type
     * @param phone
     * @return
     */
    BaseResult<?> phoneCodeCreate(VerifyType type, String phone);

    /**
     * 获取短信验证码
     *
     * @param type
     * @param phone
     * @return
     */
    BaseResult<String> getPhoneCode(VerifyType type, String phone);

    /**
     * 发送短息
     *
     * @param type
     * @param phone
     * @param verifyCode
     * @return
     */
    BaseResult<?> phoneCodeCreate(VerifyType type, String phone, String verifyCode);

    /**
     * 验证验证码
     *
     * @param type
     * @param destination
     * @param inputCode
     * @return
     */
    BaseResult<?> verifyVerifyCode(VerifyType type, String destination, String inputCode);

    /**
     * 获取图形验证码
     *
     * @param httpServletRequest
     * @param httpServletResponse
     * @param verifyType
     */
    void getCaptcha(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, VerifyType verifyType);

    /**
     * 验证图形验证码
     *
     * @param httpServletRequest
     * @param verifyType
     * @param captcha
     * @return
     */
    boolean verifyCaptcha(HttpServletRequest httpServletRequest, VerifyType verifyType, String captcha);

    /**
     * 发送邮件验证码
     *
     * @param verifyType
     * @param email
     * @param response
     * @param session
     * @return
     */
    BaseResult<?> emailCodeCreate(VerifyType verifyType, String email, HttpServletResponse response, HttpSession session);

    /**
     * 获取设备验证码
     *
     * @param deviceId
     * @return
     */
    BaseResult<?> deviceCodeCreate(String deviceId);
}
